{{extend "layout.html"}}

{{block menu}}
{{menu('admin')}}
{{end}}

{{block content_tool_container}}
{{end}}

{{block content_sidebar}}
{{use "jquery"}}
{{use "jsmenu"}}
{{
menu_items = []
if request.user:
    menu_items.append(
        {
        'name': 'user',
        'title':_('Settings'),
        'subs':[
                {'name': 'information', 'title':_('Information'), 'link':'/user/view'},
                {'name': 'password', 'title':_('Change Password'), 'link':'/user/change_password'},
                ]
        },
    )
pass
if request.user and request.user.is_superuser:
    menu_items.append(
        {
            'name': 'user_admin',
            'title':_('Admin Settings'),
            'subs':[
                {'name':'users', 'title':_('User Manager'), 'link':'/users/list'},
                {'name':'roles', 'title':'角色管理', 'link':'/admin/roles'},
                {'name':'permissions', 'title':'权限管理', 'link':'/admin/permissions'},
            ]
        }
    )
pass
if request.user:
    menu_items.append(
        {
            'name': 'messages',
            'title': '消息',
            'subs':[
                    {'name': 'receive', 'title':'接收消息', 'link':'/admin/messages/list'},
                    {'name': 'send', 'title':'发送消息', 'link':'/admin/messages/send'},
                    {'name': 'havesend', 'title':'已发消息', 'link':'/admin/messages/sended_list'},
                    ]
            }
            
    )
pass
if request.user:
    menu_items.append(
        {
            'name': 'blog',
            'title': '博客',
            'subs':[
                    {'name': 'category', 'title':'分类管理', 'link':'/blog/admin/category'},
                    {'name': 'tag', 'title':'标签管理', 'link':'/blog/admin/tag'},
                    {'name': 'blog', 'title':'博客管理', 'link':'/blog/admin/blog'},
                    ]
            }
            
    )
pass

if has_role(request.user, 'superuser'):
    menu_items.append(
        {
            'name':'forum',
            'title':'论坛',
            'link':'/forum/admin'
        }
    )
pass
if has_role(request.user, 'superuser'):
    menu_items.append(
        {
            'name':'classes',
            'title':'课程',
            'subs':[
                    {'name': 'category', 'title':'课程分类', 'link':'/class/admin/category'},
                    {'name': 'teacher', 'title':'教师管理', 'link':'/class/admin/teacher'},
                    {'name': 'class', 'title':'课程管理', 'link':'/class/admin/class'},
                    ]
        }
    )
elif has_role(request.user, 'teacher'):
    menu_items.append(
        {
            'name':'classes',
            'title':'课程',
            'subs':[
                    {'name': 'class', 'title':'课程管理', 'link':'/class/admin/class'},
                    ]
        }
    )
pass

}}  
<div class="sidebar">
    {{block sub_menu}}
    {{sub_menu(menu_items, 'user')}}
    {{end}}
</div>
{{end}}
